package top.hundreds.oasys.bean.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
@Getter
public enum MatterType {

    SICK_LEAVE(0, "个人事项"),
    PROJECT_CREATE(1, "项目事项");

    @JsonValue
    @EnumValue
    private final Integer value;

    private final String label;

    public static MatterType formValue(Object o) {
        if (o != null) {
            for (MatterType type : values()) {
                if (type.getValue().equals(o)) {
                    return type;
                }
            }
        }
        return null;
    }

    public static MatterType formLabel(Object o) {
        if (o != null) {
            for (MatterType type : values()) {
                if (type.getLabel().equals(o)) {
                    return type;
                }
            }
        }
        return null;
    }
}
